package com.java.demo.component;

import com.java.demo.entity.User;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Controller;

@Controller
@Order(20)//这个注解指的是注入顺序的控制
public class UserBeans {

    @Bean(name = {"user1", "u1"})
    public User user1() {
        User user = new User();
        user.setUserId(1);
        user.setUsername("张三");
        user.setPassword("123456");
        user.setAge(18);
        return user;
    }
    @Bean
    public User getUserByName() {
        User user = new User();
        user.setUserId(2);
        user.setUsername("李四");
        user.setPassword("123456");
        user.setAge(20);
        return user;
    }
}
